import { defineStore } from "pinia";
import { type News } from "@/components/News.vue";

export const useNewsStore = defineStore('news', {
    //方法
    actions: {
        add(value: News) {
            this.newsList.push(value)
        }
    },
    //正真存放数据的地方
    state() {
        return {
            newsList: [
                {
                    id: 1,
                    title: '一只狗',
                    content: '漂亮小狗狗'
                },
                {
                    id: 2,
                    title: '一只猫',
                    content: '漂亮小猫猫'
                }
            ]
        }
    }
})